home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-08-12 | 8.3 KB | 365 lines | [TEXT/MPS ] |
- ;
- ; File: Multiprocessing.a
- ;
- ; Contains: Multiprocessing interfaces
- ;
- ; Version: Technology: System 7.5
- ; Release: Universal Interfaces 3.0.1
- ;
- ; Copyright: © 1996-1997 by Apple Computer, Inc. and © 1995-1997 DayStar Digital, Inc.
- ;
- ; Bugs?: Please include the the file and version information (from above) with
- ; the problem description. Developers belonging to one of the Apple
- ; developer programs can submit bug reports to:
- ;
- ; devsupport@apple.com
- ;
- ;
- IF &TYPE('__MULTIPROCESSING__') = 'UNDEFINED' THEN
- __MULTIPROCESSING__ SET 1
-
- IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
- include 'Types.a'
- ENDIF
- IF &TYPE('__CODEFRAGMENTS__') = 'UNDEFINED' THEN
- include 'CodeFragments.a'
- ENDIF
-
- IF TARGET_CPU_PPC THEN
-
- MPLibrary_MajorVersion EQU 1
- MPLibrary_MinorVersion EQU 4
- MPLibrary_Release EQU 1
- MPLibrary_DevelopmentRevision EQU 2
-
-
-
-
-
-
-
-
- ; typedef UInt32 MPSemaphoreCount
-
- ; typedef UInt32 MPTaskOptions
-
-
- kDurationImmediate EQU 0
- kDurationForever EQU $7FFFFFFF
-
- kMPNoID EQU 0
-
- ;
- ; extern UInt32 MPProcessors(void )
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPProcessors
- ENDIF
-
- ;
- ; extern OSStatus MPCreateTask(TaskProc entryPoint, void *parameter, ByteCount stackSize, MPQueueID notifyQueue, void *terminationParameter1, void *terminationParameter2, MPTaskOptions options, MPTaskID *task)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPCreateTask
- ENDIF
-
-
- ;
- ; extern OSStatus MPTerminateTask(MPTaskID task, OSStatus terminationStatus)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPTerminateTask
- ENDIF
-
-
- ;
- ; extern void MPExit(OSStatus status)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPExit
- ENDIF
-
-
- ;
- ; extern MPTaskID MPCurrentTaskID(void )
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPCurrentTaskID
- ENDIF
-
-
- ;
- ; extern void MPYield(void )
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPYield
- ENDIF
-
-
- ;
- ; extern OSStatus MPCreateQueue(MPQueueID *queue)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPCreateQueue
- ENDIF
-
-
- ;
- ; extern OSStatus MPDeleteQueue(MPQueueID queue)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPDeleteQueue
- ENDIF
-
-
- ;
- ; extern OSStatus MPNotifyQueue(MPQueueID queue, void *param1, void *param2, void *param3)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPNotifyQueue
- ENDIF
-
-
- ;
- ; extern OSStatus MPWaitOnQueue(MPQueueID queue, void **param1, void **param2, void **param3, Duration timeout)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPWaitOnQueue
- ENDIF
-
-
- ;
- ; extern OSStatus MPCreateSemaphore(MPSemaphoreCount maximumValue, MPSemaphoreCount initialValue, MPSemaphoreID *semaphore)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPCreateSemaphore
- ENDIF
-
-
-
- ;
- ; extern OSStatus MPWaitOnSemaphore(MPSemaphoreID semaphore, Duration timeout)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPWaitOnSemaphore
- ENDIF
-
-
- ;
- ; extern OSStatus MPSignalSemaphore(MPSemaphoreID semaphore)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPSignalSemaphore
- ENDIF
-
-
- ;
- ; extern OSStatus MPDeleteSemaphore(MPSemaphoreID semaphore)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPDeleteSemaphore
- ENDIF
-
-
- ;
- ; extern OSStatus MPCreateCriticalRegion(MPCriticalRegionID *criticalRegion)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPCreateCriticalRegion
- ENDIF
-
-
- ;
- ; extern OSStatus MPEnterCriticalRegion(MPCriticalRegionID criticalRegion, Duration timeout)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPEnterCriticalRegion
- ENDIF
-
-
- ;
- ; extern OSStatus MPExitCriticalRegion(MPCriticalRegionID criticalRegion)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPExitCriticalRegion
- ENDIF
-
-
- ;
- ; extern OSStatus MPDeleteCriticalRegion(MPCriticalRegionID criticalRegion)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPDeleteCriticalRegion
- ENDIF
-
-
- ;
- ; extern LogicalAddress MPAllocate(ByteCount size)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPAllocate
- ENDIF
-
- ;
- ; extern void MPFree(LogicalAddress object)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPFree
- ENDIF
-
-
- ;
- ; extern void MPBlockCopy(LogicalAddress sourcePtr, LogicalAddress destPtr, ByteCount blockSize)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPBlockCopy
- ENDIF
-
-
- ; **************************************************************************
- ; *
- ; * MPTaskIsToolboxSafe() and MPRPC() were functions added by DayStar.
- ; * The 1.4 MPLibrary exports the names with an underscore prefix.
- ; * To work around this, #defines have been added to automatically
- ; * add the underscore.
- ; *
- ;
-
- ;
- ; MPTaskIsToolboxSafe() allows routines which are otherwise unaware that
- ; they are being called from an MP task to check to see if it is permissible
- ; to make a call to the Macintosh toolbox. (It is okay to make toolbox
- ; calls only if the routine is not being called from an MP task).
- ;
-
- ;
- ; extern Boolean MPTaskIsToolboxSafe(MPTaskID task)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPTaskIsToolboxSafe
- ENDIF
-
- ;
- ; MPRPC() calls its MPRemoteProcedure parameter in the application's main
- ; thread when the app next calls WaitNextEvent, EventAvail, SystemTask,
- ; MPYield, MPWaitOnQueue, MPWaitOnSemaphore, or MPEnterCriticalRegion. The
- ; return value of the MPRemoteProcedure is returned as the result of MPRPC.
- ; The MPRemoteProcedure function can call any toolbox function except
- ; SystemTask (or anything that calls it).
- ;
-
- ;
- ; extern void *MPRPC(MPRemoteProcedure theProc, void *parameter)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MPRPC
- ENDIF
-
-
-
- ; **************************************************************************
- ; *
- ; * The following routines were added by DayStar for debugging purposes.
- ; * You should not use these in shipping products. You can tell which
- ; * functions are for debugging only because they begin with an underscore
- ; *
- ;
-
- ;
- ; extern Boolean _MPIsFullyInitialized(void )
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION _MPIsFullyInitialized
- ENDIF
-
-
- ;
- ; MPAllocateSys() does the same thing as MPAllocate() except the memory
- ; is allocated from the system heap.
- ;
-
- ;
- ; extern LogicalAddress _MPAllocateSys(ByteCount size)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION _MPAllocateSys
- ENDIF
-
-
- ;
- ; extern Boolean _MPLibraryIsCompatible(const char *versionCString, UInt32 major, UInt32 minor, UInt32 release, UInt32 revision)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION _MPLibraryIsCompatible
- ENDIF
-
- ;
- ; MPLibraryVersion() retrieves the hardcoded version information built into
- ; the currently active Multiprocessing API Library.
- ;
-
- ;
- ; extern void _MPLibraryVersion(const char **versionCString, UInt32 *major, UInt32 *minor, UInt32 *release, UInt32 *revision)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION _MPLibraryVersion
- ENDIF
-
- ;
- ; extern void _MPInitializePrintf(MPPrintfHandler pfn)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION _MPInitializePrintf
- ENDIF
-
- ;
- ; extern void _MPPrintf(const char *format, ...)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION _MPPrintf
- ENDIF
-
-
- ;
- ; MPDebugStr() works just like DebugStr() except that it is safe
- ; to call it from an MP task.
- ;
-
- ;
- ; extern void _MPDebugStr(ConstStr255Param msg)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION _MPDebugStr
- ENDIF
-
- ;
- ;
- ; MPStatusPString() and MPStatusCString() provide a way to translate an OSStatus
- ; value returned from one of the MP API calls into either a Pascal string or a
- ; C string. Thus, if an MPLibrary function returns an error then the application
- ; (not a task) could use the following:
- ;
- ; status = MPxxx( function_params );
- ; DebugStr( MPStatusPString( status ) );
- ;
- ;
-
- ;
- ; extern StringPtr _MPStatusPString(OSStatus status)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION _MPStatusPString
- ENDIF
-
- ;
- ; extern const char *_MPStatusCString(OSStatus status)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION _MPStatusCString
- ENDIF
-
-
- ENDIF ; TARGET_CPU_PPC
- ENDIF ; __MULTIPROCESSING__
-
-